package com.device.grant.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.device.grant.dao.BaseDao;
import com.device.grant.dao.ConsumeinfoDao;
import com.device.grant.pojo.Consumeinfo;
import com.device.grant.utils.ColumnCompator;
import com.device.grant.utils.SQLUtils2;

@Repository("consumeinfoDao")
public class ConsumeinfoDaoImpl extends BaseDao<Consumeinfo> implements ConsumeinfoDao {

	private static final String	ID		= "id";

	private static final String	TABLE	= "Consumeinfo";

	public Integer countConsumeinfoInPageForTime(Map<String, Object> conditions, List<String> blearParams,
			Map<String, ColumnCompator> compators) {
		Map<String, Object> map = SQLUtils2.generalCountSQLForCompare(TABLE, ID, conditions, blearParams, compators);

		return simpleJdbcTemplate.queryForInt(map.get(SQLUtils2.SQL).toString(), (Object[]) map.get(SQLUtils2.PARAMS));
	}

	public List<Consumeinfo> queryAppointmentsInPageForTime(Integer page, Integer rows, Map<String, Object> conditions,
			List<String> blearParams, Map<String, ColumnCompator> compators) {
		String sql = SQLUtils2.genearlQuerySQLForCompareAndNotIn(TABLE, ID, page, rows, conditions, blearParams, compators, null);

		return super.queryInSQL(sql);
	}

}
